package com.yjtc.cbg.basicmvpframwork.ui.base;

import android.app.Activity;
import android.app.Fragment;
import android.content.Context;

import com.yjtc.cbg.basicmvpframwork.common.rx.ProgressDialogHandler;
import com.yjtc.cbg.basicmvpframwork.common.rx.RXErrorHandler;

import rx.Observable;

/**
 * Title: basicmvpframwork
 * <p>
 * Description:
 * <p>
 * Author:baigege (baigegechen@gmail.com)
 * <p>
 * Date:2017-05-26
 */
public class BasePresenter<T extends BaseView, M extends BaseModel> {

    private T mView;

    private M mModel;

    private RXErrorHandler mErrorHandler;

    private ProgressDialogHandler mDialogHandler;

    public BasePresenter(T view, M model) {
        mView = view;
        mModel = model;
    }

    //根据BaseView获取context对象
    private Context getContext() {
        if (mView instanceof Fragment) {
            return ((Fragment) mView).getActivity();
        } else {
            return (Activity) mView;
        }
    }

}
